package testutils;

import java.lang.reflect.Field;

public class LogUtils {
    private LogUtils() {
    }

    // 类型要有空参构造
    public static void printObject(Object object) {
        System.out.println("{");
        for (Field field : object.getClass().getDeclaredFields()) {
            try {
                field.setAccessible(true);
                Object o = field.get(field);
                System.out.println("\t" + field.getName() + "=" + (o != null ? o.toString(): ""));
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
        System.out.println("}");
    }
}
